<include file="Admin:header" />
<load href="./Public/Js/swfupload.js"/>
<div id="msg"></div>
<form name="myform" id="myform" action="<if condition="$action_name=='add'">{:U($module_name.'/insert')}<else />{:U($module_name.'/update')}</if>" method="post">
<div id="filelist" class="hide"></div>
<div class="error"><ul></ul></div>





<table cellpadding=0 cellspacing=0 class="table_form" id="tableBody">

<tr id="firsttr" class="CaseRow">
		<td>产品编码</td>
        <td id="box_stocktitle">
		<select name="stocktitle[]"  id="stocktitle" validate=""  title="必选">
			<volist name="productadmin" id="r">
			<option value="{$r['id']}">{$r['productcode']}</option>
			</volist>
		</select>
		</td>
		<td>规格型号</td>
        <td id="box_specifications">
		<input type="text"   class="input-text " name="specifications[]"  id="specifications" value="{$vo['specifications']}" size=""  validate="" /></td>
		<td>数量</td>
        <td id="box_number">
		<input type="text" validate=""  class="input-text " name="number[]"  id="number" value="1" size="5" /></td>
		<td>价格</td>
        <td id="box_quotation">
		<input type="text"   class="input-text " name="quotation[]"  id="quotation" value="0" size="5"  validate="" /> 		</td>
		<td>总价</td>
        <td id="box_totalprice">
		<input type="text"   class="input-text " name="totalprice[]"  id="totalprice" value="0" size="5"  validate="" /><a onclick="AddRow();" href="#">增加一行</a></td>
</tr>
	<tr>
		<td>供应商</td>
        <td id="box_title">
		<select name="title"  id="title" validate=""  title="必选">
			<volist name="Suppliermo" id="r">
			<option value="{$r['id']}"  <if condition="$r['title'] ==$vo['title']">selected="selected"</if>>{$r['title']}</option>
			</volist>
		</select>
		</td>
	</tr>
	<tr>
		<td>总价</td>
        <td id="box_supplieprice">
		<input type="text"   class="input-text " name="supplieprice"  id="supplieprice" value="" size=""  validate="" /> 		</td>
	</tr>
	<tr>
		<td>经手人</td>
        <td id="box_handling">
		<input type="text"   class="input-text " name="handling"  id="handling" value="" size=""  validate="" /> 		</td>
	</tr>
	<tr>
		<td>同步入库</td>
        <td id="box_syn">
		<input type="checkbox" name="syn" id="syn" value="1" /> 		</td>
	</tr>
	<tr>
		<td>发布时间</td>
        <td id="box_createtime">
		<input  class="Wdate input-text  "  validate=""   name="createtime" type="text" id="createtime" size="25" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'
		})" value="<?php echo date('Y-m-d H:i:s'); ?>" />		</td>
	</tr>
		</table>

		<div id="bootline"></div>
		<div id="btnbox" class="btn">
		<if condition="$vo['id']!=''"><input TYPE="hidden" name="id" value="{$vo.id}"></if>
		<INPUT TYPE="submit"  value="{:L('dosubmit')}" class="button" >
		<input TYPE="reset"  value="{:L('cancel')}" class="button">
		</div>
{__TOKEN__}
</form>
</div>

<script>
function   AddRow(){
	if($('.CaseRow').length>=2){
		newtr=document.getElementById('tableBody').insertRow(2);
	}else{
		newtr=document.getElementById('tableBody').insertRow(1);
	}
	newtr.className='CaseRow';
	td = newtr.insertCell(0);
	td.innerHTML = "产品";
	td = newtr.insertCell(1);
	td.innerHTML = $('#box_stocktitle').html();
	td = newtr.insertCell(2);
	td.innerHTML = "规格型号";
	td = newtr.insertCell(3);
	td.innerHTML = $('#box_specifications').html();
	td = newtr.insertCell(4);
	td.innerHTML = "数量";
	td = newtr.insertCell(5);
	td.innerHTML = $('#box_number').html();

	td = newtr.insertCell(6);
	td.innerHTML = "价格";
	td = newtr.insertCell(7);
	td.innerHTML = $('#box_quotation').html();

	td = newtr.insertCell(8);
	td.innerHTML = "总价";
	td = newtr.insertCell(9);
	if($('.CaseRow').length>2){
		td.innerHTML = '<input type="text"   class="input-text " name="totalprice[]"  id="totalprice" value="0" size="5"  validate="" />';
	}else{
		td.innerHTML = '<input type="text"   class="input-text " name="totalprice[]"  id="totalprice" value="0" size="5"  validate="" /><a onclick="RemoveRow(1);" href="#">移除一行</a>';
	}
}   

function   RemoveRow(index){ 
	document.getElementById('tableBody').deleteRow($('.CaseRow').length-1);
}
</script>